# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>

_realname=gexiv2
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.10.3
pkgrel=3
arch=('any')
pkgdesc="GObject-based wrapper around the Exiv2 library (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-exiv2"
         "${MINGW_PACKAGE_PREFIX}-python2")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-python2-gobject"
             "${MINGW_PACKAGE_PREFIX}-python3-gobject"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "gtk-doc")
options=('strip' 'staticlibs')
license=("LGPL 2.1")
url="https://www.gnome.org/"
source=(https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz
        001-win.patch)
sha256sums=('390cfb966197fa9f3f32200bc578d7c7f3560358c235e6419657206a362d3988'
            '1ba351119f9112ba649dd4397b712ee04d8327d5d056d3587f77c824f7846438')

prepare() {
  cd ${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/001-win.patch

  AUTOPOINT='intltoolize --automake --copy' autoreconf -fiv
}

build() {
  [[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib \
    --enable-introspection

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}
